Easy2Siksha.com
GNDU QUESTION PAPERS 2025
Bachelor of Computer Applicaon (BCA) 4th Semester
(Batch 2023-26) (CBGS)
BCA04004T: SYSTEM SOFTWARE
Time Allowed: 3 Hours Maximum Marks: 100
Note: Aempt Five quesons in all, selecng at least One queson from each secon. The
Fih queson may be aempted from any secon. All quesons carry equal marks
SECTION-A
1. What is System Soware? Explain various components of a Compiler.
2. What is role of loader and compiler? Write the dierences between dierent types of
translators.
SECTION-B
3. Dierenate between the design issues of One pass and Two pass assemblers. Explain
dierent tables used in assembler.
4. What is macro expansion? Explain condional and recursive macro expansion.
SECTION-C
5. Explain following in detail:
(a) Parsing
Easy2Siksha.com
(b) Storage Management
6. Which are dierent phases of compilaon process? What is Cross Compiler and
Incremental Compiler?
SECTION-D
7. (a) What are basic funcons of a loader?
(b) What is dierence between Stac and Dynamic Linking?
8. What do you mean by Editors? Discuss their usefulness with the help of suitable
examples.
Easy2Siksha.com
GNDU ANSWER PAPERS 2025
Bachelor of Computer Applicaon (BCA) 4th Semester
(Batch 2023-26) (CBGS)
BCA04004T: SYSTEM SOFTWARE
Time Allowed: 3 Hours Maximum Marks: 100
Note: Aempt Five quesons in all, selecng at least One queson from each secon. The
Fih queson may be aempted from any secon. All quesons carry equal marks
SECTION-A
1. What is System Soware? Explain various components of a Compiler.
Ans: 󷈷󷈸󷈹󷈺󷈻󷈼 1. What is System Software?
Imagine your computer is like a car.
The hardware (CPU, RAM, keyboard) is like the engine and parts of the car.
But without something to control it, the car won’t run.
󷷑󷷒󷷓󷷔 That “something” is System Software.
󹵙󹵚󹵛󹵜 Simple Definition:
System software is a type of software that manages and controls computer hardware and
provides a platform for running application software.
󹲉󹲊󹲋󹲌󹲍 Real-Life Example
When you turn on your computer:
You don’t directly talk to the CPU.
Instead, the Operating System (like Windows or Linux) acts as a bridge.
Easy2Siksha.com
So, system software is like a translator + manager between:
You (user)
Applications (like Chrome, MS Word)
Hardware (CPU, memory)
󹻯 Types of System Software
1. Operating System (OS)
Example: Windows, Linux
󷷑󷷒󷷓󷷔 Controls everything (memory, files, processes)
2. Device Drivers
󷷑󷷒󷷓󷷔 Help hardware like printer, keyboard work properly
3. Language Translators
󷷑󷷒󷷓󷷔 Convert human-written code into machine language
(Compiler, Interpreter, Assembler)
4. Utility Software
󷷑󷷒󷷓󷷔 Helps maintain system (antivirus, disk cleaner)
󷈷󷈸󷈹󷈺󷈻󷈼 2. What is a Compiler?
Before understanding components, let’s understand the Compiler first.
󹵙󹵚󹵛󹵜 Simple Definition:
A compiler is a program that converts high-level language (like C, Java) into machine
language (0s and 1s).
󹲉󹲊󹲋󹲌󹲍 Real-Life Analogy
Think of a compiler as a language translator:
You speak English (High-level language)
Computer understands Binary (Machine language)
󷷑󷷒󷷓󷷔 Compiler translates your program so the computer can understand it.
󷄧󹹯󹹰 How Compiler Works (Basic Flow)
Easy2Siksha.com
󷷑󷷒󷷓󷷔 Steps
1. You write code → Source Code
2. Compiler checks errors
3. Converts it into machine code
4. Output → Executable file
󷈷󷈸󷈹󷈺󷈻󷈼 Components (Phases) of a Compiler
A compiler works in multiple stages (phases). Think of it like an assembly line in a factory.
Let’s understand each phase step-by-step in a very simple way.
󼩺󼩻 1. Lexical Analysis (Scanner)
󹵙󹵚󹵛󹵜 What it does:
Easy2Siksha.com
Breaks code into small pieces called tokens
󹲉󹲊󹲋󹲌󹲍 Example:
int x = 10;
󷷑󷷒󷷓󷷔 Tokens:
int
x
=
10
;
󷘹󷘴󷘵󷘶󷘷󷘸 Simple Meaning:
󷷑󷷒󷷓󷷔 It checks spelling and separates words
󼩺󼩻 2. Syntax Analysis (Parser)
󹵙󹵚󹵛󹵜 What it does:
Checks whether the sentence structure is correct (grammar check)
󹲉󹲊󹲋󹲌󹲍 Example:
int = x 10;
󽆱 Wrong order Syntax error
󷘹󷘴󷘵󷘶󷘷󷘸 Simple Meaning:
󷷑󷷒󷷓󷷔 Like checking grammar in English sentence
󼩺󼩻 3. Semantic Analysis
󹵙󹵚󹵛󹵜 What it does:
Checks meaning of the program
󹲉󹲊󹲋󹲌󹲍 Example:
Easy2Siksha.com
int x;
x = "Hello";
󽆱 Error assigning string to integer
󷘹󷘴󷘵󷘶󷘷󷘸 Simple Meaning:
󷷑󷷒󷷓󷷔 Checks whether the statement makes logical sense
󼩺󼩻 4. Intermediate Code Generation
󹵙󹵚󹵛󹵜 What it does:
Converts program into an intermediate form
󹲉󹲊󹲋󹲌󹲍 Example:
x = a + b
󷷑󷷒󷷓󷷔 Intermediate:
t1 = a + b
x = t1
󷘹󷘴󷘵󷘶󷘷󷘸 Simple Meaning:
󷷑󷷒󷷓󷷔 Creates a simplified version for easy processing
󼩺󼩻 5. Code Optimization
󹵙󹵚󹵛󹵜 What it does:
Improves code efficiency (makes it faster & smaller)
󹲉󹲊󹲋󹲌󹲍 Example:
x = 2 * 5
󷷑󷷒󷷓󷷔 Optimized:
x = 10
󷘹󷘴󷘵󷘶󷘷󷘸 Simple Meaning:
Easy2Siksha.com
󷷑󷷒󷷓󷷔 Removes unnecessary work
󼩺󼩻 6. Code Generation
󹵙󹵚󹵛󹵜 What it does:
Generates final machine code
󷘹󷘴󷘵󷘶󷘷󷘸 Simple Meaning:
󷷑󷷒󷷓󷷔 Converts optimized code into binary (0s and 1s)
󷄧󹹯󹹰 Complete Compiler Structure
Easy2Siksha.com
󼩏󼩐󼩑 Extra Components (Supporting Parts)
These help all phases:
󹵙󹵚󹵛󹵜 1. Symbol Table
󷷑󷷒󷷓󷷔 Stores variables, functions, names
Example:
x → integer
y → float
󹵙󹵚󹵛󹵜 2. Error Handler
󷷑󷷒󷷓󷷔 Detects and reports errors at every stage
󹵍󹵉󹵎󹵏󹵐 Summary Table
Phase
Work
Lexical
Break into tokens
Syntax
Check grammar
Semantic
Check meaning
Intermediate
Create middle code
Optimization
Improve code
Code Generation
Produce machine code
󷘹󷘴󷘵󷘶󷘷󷘸 Final Understanding
󷷑󷷒󷷓󷷔 System software is the boss of the computerit controls everything and makes sure
programs run smoothly.
󷷑󷷒󷷓󷷔 A compiler is a translator + checker + optimizer that:
Understands your code
Fixes errors
Converts it into machine language
󹲶󹲷 Easy One-Line Conclusion
Easy2Siksha.com
System Software = Controls and manages the computer
Compiler = Converts human-readable code into machine language through multiple steps
2. What is role of loader and compiler? Write the dierences between dierent types of
translators.
Ans: 󷇮󷇭 Role of Loader and Compiler
When you write a program, say in C or Java, you’re writing in a high-level language
something humans can understand. But computers only understand machine language
(binary 0s and 1s). To bridge this gap, we need translators like compilers, interpreters,
assemblers, and loaders.
󽆪󽆫󽆬 Compiler
A compiler is like a translator who takes your entire book (program) written in English (high-
level language) and translates it into Chinese (machine language) before anyone reads it.
Role of Compiler:
Translates the whole source code into machine code at once.
Checks for errors during compilation (syntax errors, type errors).
Produces an object code or executable file.
Makes execution faster because the program is already translated before running.
Analogy: Imagine you wrote a novel in English. A compiler translates the entire novel into
Hindi before publishing. Readers get the Hindi version directly, without needing translation
while reading.
󽆪󽆫󽆬 Loader
Once the compiler has created the machine code, the loader comes into play.
Role of Loader:
Loads the compiled program (object code) into memory.
Prepares it for execution by the CPU.
Handles memory allocation and linking with libraries.
Analogy: If the compiler is the translator who prepares the Hindi version of your novel, the
loader is the publisher who places the book on the shelf, ready for readers to pick up.
Diagram 1: Compiler and Loader Workflow
Source Code → Compiler → Object Code → Loader → Execution in Memory
Easy2Siksha.com
󼩺󼩻 Types of Translators
Now let’s explore the different types of translators in computer systems. Translators are
programs that convert one form of code into another.
1. Compiler
Translates the entire source code into machine code at once.
Produces an executable file.
Errors are reported after compilation.
Example: C, C++ compilers.
Pros: Fast execution. Cons: Errors are harder to debug because they’re reported after
compilation.
2. Interpreter
Translates source code line by line and executes immediately.
No separate executable file is produced.
Example: Python, JavaScript interpreters.
Pros: Easier debugging (errors shown immediately). Cons: Slower execution because
translation happens during runtime.
3. Assembler
Translates assembly language (low-level, human-readable mnemonics like MOV,
ADD) into machine code.
Example: MASM, NASM.
Pros: Efficient for hardware-level programming. Cons: Not portable across different
hardware.
4. Loader
Loads compiled code into memory for execution.
Works closely with the operating system.
5. Linker
Combines multiple object files and libraries into a single executable.
Resolves references between files.
Diagram 2: Types of Translators
High-Level Code → Compiler → Machine Code
High-Level Code → Interpreter → Line-by-Line Execution
Assembly Code → Assembler → Machine Code
Easy2Siksha.com
Object Code → Loader → Execution
Multiple Object Files → Linker → Executable
󹵍󹵉󹵎󹵏󹵐 Differences Between Translators
Translator
Input Language
Output
Language
Execution Style
Example
Languages
Compiler
High-level
language
Machine code
Entire program at
once
C, C++
Interpreter
High-level
language
Machine code
Line by line
Python,
JavaScript
Assembler
Assembly
language
Machine code
Entire program
Assembly
Loader
Object code
Loaded in
memory
Prepares for
execution
OS utility
Linker
Object files
Executable file
Combines files
C, C++ projects
󷘜󷘝󷘞󷘟󷘠󷘡󷘢󷘣󷘤󷘥󷘦 Everyday Example
Imagine you’re cooking a recipe:
Compiler: Translates the entire recipe into your native language before you start
cooking.
Interpreter: Reads the recipe line by line and tells you what to do step by step.
Assembler: Converts shorthand cooking notes (like “chop veg”) into full instructions.
Loader: Places the ingredients on the counter, ready to cook.
Linker: Combines multiple recipes into a full meal plan.
󺄄󺄅󺄌󺄆󺄇󺄈󺄉󺄊󺄋󺄍 Extra Diagrams
Diagram 3: Compiler vs Interpreter
Compiler: Source Code → Machine Code → Execute
Interpreter: Source Code → Translate & Execute (line by line)
Diagram 4: Assembler Role
Assembly Code (MOV A, B) → Assembler → Machine Code (10101010)
Diagram 5: Loader and Linker
Object Files → Linker → Executable → Loader → Memory → Execution
󽆪󽆫󽆬 Conclusion
So, to wrap it up:
Easy2Siksha.com
The compiler translates high-level code into machine code, while the loader places
that code into memory for execution.
Translators come in different types: compilers, interpreters, assemblers, loaders, and
linkers.
Each has its own role: compilers for speed, interpreters for flexibility, assemblers for
hardware-level control, loaders for execution, and linkers for combining code.
Together, they form the backbone of how human-readable programs are transformed into
instructions that computers can actually run.
SECTION-B
3. Dierenate between the design issues of One pass and Two pass assemblers. Explain
dierent tables used in assembler.
Ans: 󷈷󷈸󷈹󷈺󷈻󷈼 Understanding Assemblers First
Imagine you are translating a book from Punjabi to English.
The book = Assembly language program
The translator = Assembler
The English version = Machine code
Now, sometimes the translator reads the whole book twice, and sometimes only once.
That’s exactly how Two-pass and One-pass assemblers work.
󼩏󼩐󼩑 One-Pass vs Two-Pass Assembler (Main Idea)
󹵙󹵚󹵛󹵜 1. One-Pass Assembler
󷷑󷷒󷷓󷷔 It reads the program only once and translates it immediately.
󹼧 Simple Example
If it sees a label like:
JUMP LOOP
But the label LOOP is defined later…
󷷑󷷒󷷓󷷔 Problem! It doesn't know where to jump yet.
Easy2Siksha.com
So it has to:
Make a guess or placeholder
Fix it later (backpatching)
󹵙󹵚󹵛󹵜 2. Two-Pass Assembler
󷷑󷷒󷷓󷷔 It reads the program twice
󹼧 Pass 1:
Finds all labels (like LOOP)
Stores their addresses
󹼧 Pass 2:
Uses stored labels
Generates correct machine code
󷄧󹹯󹹰 Diagram: One-Pass vs Two-Pass
󽀼󽀽󽁀󽁁󽀾󽁂󽀿󽁃 Difference Between One-Pass and Two-Pass Assembler
One-Pass Assembler
Two-Pass Assembler
Only 1
2 passes
Faster
Slower
Easy2Siksha.com
More complex logic
Simpler logic
Difficult (uses backpatching)
Easy
Less
More
Slightly tricky
More reliable
Hard
Easy
󷘹󷘴󷘵󷘶󷘷󷘸 Design Issues (Important for Exams)
Let’s understand what “design issues” actually mean.
󷷑󷷒󷷓󷷔 It means: What problems arise while designing these assemblers?
󹼣 Design Issues in One-Pass Assembler
1. Forward Reference Problem
When a symbol is used before being defined.
󷷑󷷒󷷓󷷔 Example:
JMP LOOP
...
LOOP: ADD A, B
LOOP is not known initially
Needs backpatching
2. Backpatching Complexity
The assembler must remember where corrections are needed
Later fix addresses
󷷑󷷒󷷓󷷔 Makes design complicated
3. Limited Flexibility
Cannot easily handle complex programs
Hard to manage large symbol tables
Easy2Siksha.com
4. Error Handling is Difficult
Errors may not be detected immediately
Hard to correct later
󺮥 Design Issues in Two-Pass Assembler
1. Extra Time Required
Program is read twice → slower
2. More Memory Needed
Must store symbol table and intermediate code
3. Intermediate File Handling
Pass 1 generates intermediate code
Pass 2 reads it again
4. But Advantage:
󷷑󷷒󷷓󷷔 Easier to design and manage
󷷑󷷒󷷓󷷔 Handles forward references easily
󹵍󹵉󹵎󹵏󹵐 Tables Used in Assembler
Assemblers use tables like notebooks to store important information.
Let’s understand each one in a very simple way 󷶹󷶻󷶼󷶽󷶺
󺮤 1. Symbol Table (SYMTAB)
󷷑󷷒󷷓󷷔 Stores:
Easy2Siksha.com
Label names
Their addresses
󹼧 Example:
Symbol
Address
LOOP
200
START
100
󷷑󷷒󷷓󷷔 Used to resolve jumps and references
󺮤 2. Literal Table (LITTAB)
󷷑󷷒󷷓󷷔 Stores constants (values used directly)
󹼧 Example:
MOV A, =5
Literal
Address
=5
300
󺮤 3. Pool Table (POOLTAB)
󷷑󷷒󷷓󷷔 Groups literals together
󹼧 Why needed?
Because literals are assigned memory later
󹼧 Example:
Pool No
Start Index
1
0
2
3
󺮤 4. Opcode Table (OPTAB)
󷷑󷷒󷷓󷷔 Stores machine instructions
󹼧 Example:
Mnemonic
Opcode
Easy2Siksha.com
ADD
01
SUB
02
MOV
03
󺮤 5. Register Table
󷷑󷷒󷷓󷷔 Stores register names
󹼧 Example:
Register
Code
A
1
B
2
󹷗󹷘󹷙󹷚󹷛󹷜 Diagram: Tables Used in Assembler
󼩺󼩻 How Everything Works Together
Let’s connect everything like a story:
1. Program enters assembler
2. Pass 1:
o Creates Symbol Table
o Stores labels
3. Pass 2:
o Uses Opcode Table
o Uses Symbol Table
o Uses Literal Table
4. Final machine code is generated 󷔬󷔭󷔮󷔯󷔰󷔱󷔴󷔵󷔶󷔷󷔲󷔳󷔸
Easy2Siksha.com
󷘹󷘴󷘵󷘶󷘷󷘸 Quick Summary
One-pass assembler
o Works in one scan
o Fast but complex
o Uses backpatching
Two-pass assembler
o Works in two scans
o Easy and reliable
o Handles forward references easily
Tables used
o Symbol Table → Labels & addresses
o Literal Table → Constants
o Pool Table → Literal grouping
o Opcode Table → Instructions
o Register Table → Registers
4. What is macro expansion? Explain condional and recursive macro expansion.
Ans: 󷇮󷇭 What is Macro Expansion?
Imagine you’re writing a long essay, and you often need to repeat a phrase like “Artificial
Intelligence is the simulation of human intelligence by machines.” Instead of typing it out
every time, you create a shortcut: whenever you type “AI_DEF,” your word processor
automatically replaces it with the full phrase.
That’s essentially what a macro is in programming: a shorthand or template that expands
into a longer set of instructions.
󷷑󷷒󷷓󷷔 Macro expansion is the process of replacing the macro name with its actual definition
during program translation.
Macros are widely used in assembly language and high-level languages to save time, reduce
repetition, and make code easier to read.
󽆪󽆫󽆬 Why Macro Expansion Matters
Saves effort: You don’t have to rewrite repetitive code.
Improves readability: Code looks cleaner and easier to understand.
Consistency: Ensures the same block of code is used everywhere.
Flexibility: Macros can take parameters, making them adaptable.
Diagram 1: Macro Expansion
Macro Definition: #define PI 3.14159
Easy2Siksha.com
Code: area = PI * r * r
After Expansion: area = 3.14159 * r * r
󼩺󼩻 Conditional Macro Expansion
Now let’s move to conditional macro expansion.
Imagine you’re cooking, and you have a recipe that says:
If you have sugar, add it.
If not, skip it.
Conditional macro expansion works the same way. It allows macros to expand differently
depending on certain conditions.
󽆪󽆫󽆬 How It Works
Uses conditional directives like #if, #else, #endif.
The macro expansion depends on whether the condition is true or false.
Useful for writing code that adapts to different environments (e.g., Windows vs
Linux).
Example
c
#define WINDOWS 1
#if WINDOWS
#define PATH "C:\\Program Files"
#else
#define PATH "/usr/bin"
#endif
If WINDOWS is defined, PATH expands to "C:\\Program Files".
Otherwise, it expands to "/usr/bin".
Diagram 2: Conditional Macro Expansion
Condition: WINDOWS = 1
Macro Expansion: PATH → "C:\\Program Files"
Condition: WINDOWS = 0
Macro Expansion: PATH → "/usr/bin"
󷘜󷘝󷘞󷘟󷘠󷘡󷘢󷘣󷘤󷘥󷘦 Everyday Analogy
Think of conditional macros like traffic lights:
Easy2Siksha.com
If the light is green, cars go.
If it’s red, cars stop. The behavior changes depending on the condition.
󼩺󼩻 Recursive Macro Expansion
Now let’s explore recursive macro expansion.
Imagine you’re telling a story, and inside the story, you repeat the same phrase again and
again. That’s recursion—something that refers back to itself.
In macro expansion, recursion happens when a macro calls itself (directly or indirectly).
󽆪󽆫󽆬 How It Works
A macro definition includes another macro, which may expand back into the original
macro.
This can lead to repeated expansion until a stopping condition is reached.
If not controlled, it can cause infinite loops.
Example
#define A B + 1
#define B A + 2
Expanding A leads to B + 1.
Expanding B leads back to A + 2.
This cycle continues recursively.
Diagram 3: Recursive Macro Expansion
A → B + 1
B → A + 2
Expansion: A → (A + 2) + 1 → keeps expanding...
󷘜󷘝󷘞󷘟󷘠󷘡󷘢󷘣󷘤󷘥󷘦 Everyday Analogy
Think of recursive macros like two mirrors facing each other. When you look into them, you
see an infinite reflection. Unless you put a limit, the expansion never ends.
󹵍󹵉󹵎󹵏󹵐 Differences Between Conditional and Recursive Macro Expansion
Feature
Conditional Macro Expansion
Recursive Macro Expansion
Definition
Expands based on conditions
Expands by referring to itself
Control
Controlled by #if, #else
Controlled by recursion rules
Use Case
Platform-dependent code, optional
features
Complex repetitive structures
Risk
None (safe)
Risk of infinite expansion
Easy2Siksha.com
Analogy
Traffic lights (conditional behavior)
Mirrors facing each other (infinite
reflection)
󺄄󺄅󺄌󺄆󺄇󺄈󺄉󺄊󺄋󺄍 Extra Diagrams
Diagram 4: Macro Expansion Flow
Source Code → Macro Processor → Expanded Code → Compiler → Executable
Diagram 5: Conditional vs Recursive
Conditional: IF condition → Expand differently
Recursive: Macro → Expands into itself repeatedly
󷘜󷘝󷘞󷘟󷘠󷘡󷘢󷘣󷘤󷘥󷘦 Everyday Example Bringing It All Together
Imagine writing a cookbook:
Macro Expansion: Instead of writing “add 1 teaspoon of salt” in every recipe, you
define a macro called ADD_SALT. Whenever you use it, it expands into the full
instruction.
Conditional Macro Expansion: If the recipe is for diabetics, skip sugar; otherwise,
add sugar.
Recursive Macro Expansion: A recipe says “repeat step 2 until all vegetables are
chopped.” That’s recursion—expanding the same instruction repeatedly.
󽆪󽆫󽆬 Conclusion
So, to wrap it up:
Macro expansion is the process of replacing macro names with their definitions,
making code shorter and easier to manage.
Conditional macro expansion allows macros to expand differently depending on
conditions, making code adaptable.
Recursive macro expansion involves macros that expand into themselves, useful for
repetitive structures but risky if uncontrolled.
Together, these techniques make programming more powerful, flexible, and efficientlike
giving you shortcuts, conditional rules, and recursive instructions to simplify complex tasks.
SECTION-C
5. Explain following in detail:
(a) Parsing
(b) Storage Management
Easy2Siksha.com
Ans: 󹶆󹶚󹶈󹶉 5. Explain the Following:
(a) Parsing
󹼧 What is Parsing? (Simple Idea)
Imagine you are reading a sentence in English:
󷷑󷷒󷷓󷷔 “Ram eats an apple.”
Your brain automatically understands:
Who is the subject → Ram
What is the action → eats
What is the object → apple
󷷑󷷒󷷓󷷔 Parsing is exactly this processbut done by a computer for programming languages.
So, Parsing = Understanding the structure of code.
󹼧 Why is Parsing Needed?
When you write a program like:
int a = 5 + 3;
The computer does NOT understand it directly.
It must:
1. Break it into pieces (tokens)
2. Understand the structure
3. Check if it's correct
4. Convert it into something executable
󷷑󷷒󷷓󷷔 Parsing is the step where the structure is analyzed.
󹼧 Steps Before Parsing (Quick Context)
Before parsing, there is Lexical Analysis:
Code → Tokens
Example:
Easy2Siksha.com
int a = 5 + 3;
Becomes:
[int] [a] [=] [5] [+] [3] [;]
󷷑󷷒󷷓󷷔 After this, parsing starts.
󹼧 How Parsing Works
The parser takes tokens and checks if they follow grammar rules.
󹵍󹵉󹵎󹵏󹵐 Diagram: Parsing Process
Easy2Siksha.com
󹼧 Types of Parsing
There are mainly two types of parsing:
1. Top-Down Parsing
󷷑󷷒󷷓󷷔 Starts from the top (root) and moves downward.
Think like:
Start with the whole sentence
Break it into smaller parts
Example:
Expression → Term + Term
2. Bottom-Up Parsing
󷷑󷷒󷷓󷷔 Starts from the input and builds upward.
Think like:
Start from words
Combine them into meaningful sentences
󹼧 Parse Tree (Very Important)
A parse tree is a diagram that shows how a sentence (or code) is structured.
Example:
Easy2Siksha.com
5 + 3 * 2
The tree ensures:
Multiplication happens first
Then addition
󹵍󹵉󹵎󹵏󹵐 Diagram: Parse Tree Example
󹼧 Syntax Errors
Parsing also helps detect errors like:
󽆱 Missing semicolon
󽆱 Wrong syntax
󽆱 Invalid structure
Example:
int = a 5;
󷷑󷷒󷷓󷷔 Parser will say: Invalid syntax
󹼧 Real-Life Analogy
Think of parsing like a teacher checking grammar in your sentence.
Wrong grammar → error
Correct grammar → accepted
󹼧 Summary of Parsing
Easy2Siksha.com
Converts tokens into structure
Checks syntax correctness
Builds parse tree
Helps compiler understand code
(b) Storage Management
󹼧 What is Storage Management?
Imagine your phone storage:
Photos stored in one folder
Apps in another
Cache somewhere else
󷷑󷷒󷷓󷷔 The system manages everything efficiently.
󷷑󷷒󷷓󷷔 Similarly, Storage Management is how a computer organizes and manages memory.
󹼧 Why Storage Management is Important?
Programs need memory to:
Store variables
Execute instructions
Save data
Without proper management:
󽆱 Memory will overflow
󽆱 Programs will crash
󽆱 System becomes slow
󹼧 Types of Memory in a Computer
Let’s understand this like a house:
󹵍󹵉󹵎󹵏󹵐 Diagram: Memory Hierarchy
Easy2Siksha.com
󹼧 Levels of Memory
1. Registers
o Fastest
o Inside CPU
o Very small
2. Cache
o Faster than RAM
o Stores frequently used data
3. RAM (Main Memory)
o Temporary storage
o Used while program runs
4. Secondary Storage
o Hard disk, SSD
o Permanent storage
󹼧 How Storage is Managed
The system must decide:
Where to store data
When to free memory
How to avoid wastage
Easy2Siksha.com
󹼧 Memory Allocation
There are two types:
1. Static Allocation
󷷑󷷒󷷓󷷔 Memory is fixed before execution
Example:
int a;
Simple
󽆱 Not flexible
2. Dynamic Allocation
󷷑󷷒󷷓󷷔 Memory is allocated during runtime
Example:
malloc(), new
Flexible
Efficient use
󽆱 Needs careful handling
󹼧 Stack vs Heap Memory
This is VERY IMPORTANT.
󹵍󹵉󹵎󹵏󹵐 Diagram: Stack vs Heap
Easy2Siksha.com
󹼧 Stack Memory
Stores function calls
Automatic management
Fast
Example:
int a = 5;
󹼧 Heap Memory
Stores dynamic data
Managed manually
Slower
Example:
int *p = malloc(sizeof(int));
󹼧 Memory Problems
Easy2Siksha.com
If storage is not managed properly, problems occur:
1. Memory Leak
󷷑󷷒󷷓󷷔 Memory is allocated but not freed
Result:
System slows down
2. Fragmentation
󷷑󷷒󷷓󷷔 Memory breaks into small pieces
Types:
Internal fragmentation
External fragmentation
󹵍󹵉󹵎󹵏󹵐 Diagram: Fragmentation
Easy2Siksha.com
󹼧 Garbage Collection
󷷑󷷒󷷓󷷔 Automatic memory cleaning system
Used in languages like:
Java
Python
Frees unused memory
Prevents memory leaks
󹼧 Real-Life Analogy
Think of storage management like a hostel room:
You allocate space for clothes
Remove unused items
Organize properly
Easy2Siksha.com
If not:
󽆱 Room becomes messy
󽆱 No space left
󹼧 Summary of Storage Management
Allocates memory
Deallocates memory
Prevents wastage
Ensures efficient execution
󷄧󼿒 Final Conclusion
Parsing is about understanding code structure
Storage Management is about managing memory
󷷑󷷒󷷓󷷔 Both are essential for a program to run correctly.
Without parsing:
󽆱 Computer cannot understand code
Without storage management:
󽆱 Program cannot run efficiently
6. Which are dierent phases of compilaon process? What is Cross Compiler and
Incremental Compiler?
Ans: 󷇮󷇭 What is Compilation?
When you write a program in a high-level language like C, Java, or Python, you’re writing
instructions in a way humans can understand. But computers only understand machine
languagebinary 0s and 1s. The job of a compiler is to translate your human-friendly code
into machine-friendly code.
󷷑󷷒󷷓󷷔 The compilation process isn’t just one step—it’s a series of phases, each with its own
role. Think of it like producing a movie: you start with a script, then casting, shooting,
editing, and finally distribution. Similarly, compilation has multiple phases that transform
source code into executable code.
Easy2Siksha.com
󽆪󽆫󽆬 Phases of Compilation Process
The compilation process is usually divided into six major phases. Let’s walk through them
step by step.
1. Lexical Analysis (Scanning)
The compiler reads the source code character by character.
Groups characters into meaningful units called tokens (keywords, identifiers,
operators).
Example: int x = 10; becomes tokens: int, x, =, 10, ;.
Analogy: Like breaking a sentence into words before understanding its meaning.
2. Syntax Analysis (Parsing)
The compiler checks whether the tokens follow the grammar rules of the language.
Builds a parse tree or syntax tree.
Example: Ensures that int x = 10; is a valid declaration.
Analogy: Like checking if a sentence is grammatically correct.
3. Semantic Analysis
Ensures the meaning of the code is valid.
Checks type compatibility, variable declarations, scope rules.
Example: You can’t add a string to an integer.
Analogy: Like checking if a sentence makes sense—“The cat drives the car” is grammatically
correct but semantically wrong.
4. Intermediate Code Generation
Converts the syntax tree into an intermediate representation (IR).
IR is easier to optimize and can be translated into different machine codes.
Example: x = a + b * c becomes IR instructions like t1 = b * c; x = a + t1;.
Analogy: Like translating a novel into a simpler draft before final translation.
5. Code Optimization
Improves the intermediate code to make it run faster or use less memory.
Example: Removing redundant calculations, reusing registers.
Analogy: Like editing a movie to remove unnecessary scenes and make it smoother.
6. Code Generation
Easy2Siksha.com
Converts optimized intermediate code into target machine code.
Produces assembly or binary instructions.
Example: MOV R1, b; MUL R1, c; ADD a, R1;.
Analogy: Like publishing the final version of a book in the target language.
7. Symbol Table and Error Handling (Supporting Phases)
Symbol Table: Keeps track of variables, functions, and their attributes.
Error Handling: Reports syntax, semantic, or runtime errors.
Diagram 1: Phases of Compilation
Source Code
Lexical Analysis → Syntax Analysis → Semantic Analysis → Intermediate Code →
Optimization → Code Generation
Executable Code
󼩺󼩻 Cross Compiler
Now let’s talk about cross compilers.
Imagine you’re writing a book in English, but your readers only understand French. You
need a translator who can produce a French version even though you don’t speak French
yourself.
󷷑󷷒󷷓󷷔 A cross compiler is a compiler that runs on one machine but generates code for another
machine (different architecture).
Features:
Useful for embedded systems (like programming microcontrollers).
Example: Writing code on a Windows PC but generating machine code for an ARM
processor.
Saves time because you don’t need the target machine to compile code.
Diagram 2: Cross Compiler
Host Machine (Windows) → Cross Compiler → Target Machine Code (ARM)
󼩺󼩻 Incremental Compiler
Now let’s explore incremental compilers.
Easy2Siksha.com
Imagine you’re editing a long essay. Instead of rewriting the whole essay every time you
change one sentence, you only update the changed part. That’s what an incremental
compiler does.
󷷑󷷒󷷓󷷔 An incremental compiler compiles only the modified portions of the source code, rather
than recompiling the entire program.
Features:
Speeds up development by reducing compilation time.
Common in IDEs (Integrated Development Environments) like Eclipse or Visual
Studio.
Useful for large projects where full compilation would take too long.
Diagram 3: Incremental Compiler
Source Code Change → Incremental Compiler → Update Only Changed Part → Faster
Execution
󹵍󹵉󹵎󹵏󹵐 Differences Between Cross Compiler and Incremental Compiler
Feature
Cross Compiler
Incremental Compiler
Definition
Compiles code for a different machine
Compiles only modified parts of
code
Use Case
Embedded systems, different
architectures
Large projects, fast development
cycles
Speed
Normal compilation speed
Faster (avoids full recompilation)
Example
GCC cross compiler for ARM
Eclipse incremental compiler
󷘜󷘝󷘞󷘟󷘠󷘡󷘢󷘣󷘤󷘥󷘦 Everyday Example
Let’s imagine you’re building a mobile app:
The compiler phases check your code step by step, ensuring it’s correct and
optimized.
A cross compiler lets you write the app on your laptop but generate code for
Android phones.
An incremental compiler ensures that when you change one button’s color, only
that part is recompiled, saving you time.
󺄄󺄅󺄌󺄆󺄇󺄈󺄉󺄊󺄋󺄍 Extra Diagrams
Diagram 4: Compilation Workflow
Source Code → Compiler Phases → Object Code → Loader → Execution
Diagram 5: Cross vs Incremental
Easy2Siksha.com
Cross Compiler: Host → Target Machine Code
Incremental Compiler: Change → Recompile Only Changed Part
󽆪󽆫󽆬 Conclusion
So, to wrap it up:
The compilation process has multiple phases: lexical analysis, syntax analysis,
semantic analysis, intermediate code generation, optimization, and code generation.
A cross compiler generates code for a different machine or architecture, making it
essential for embedded systems.
An incremental compiler compiles only the changed parts of code, speeding up
development in large projects.
Together, these concepts show how compilers not only translate code but also adapt to
different needs—whether it’s targeting another machine or saving time during
development.
SECTION-D
7. (a) What are basic funcons of a loader?
(b) What is dierence between Stac and Dynamic Linking?
Ans: 󷈷󷈸󷈹󷈺󷈻󷈼 7 (a) What are the basic functions of a Loader?
󹲉󹲊󹲋󹲌󹲍 First, what is a Loader?
Imagine you wrote a program in C or Java. After compiling it, you get an executable file (like
.exe). But your program still cannot run directly.
󷷑󷷒󷷓󷷔 Why?
Because it is sitting on your hard disk, not in memory.
󷷑󷷒󷷓󷷔 So who brings it into memory and prepares it to run?
That’s the job of a Loader.
󷷑󷷒󷷓󷷔 In simple words:
Loader = Program that loads your program into RAM and prepares it for execution
󼩏󼩐󼩑 Real-Life Example
Easy2Siksha.com
Think of your program as a movie file, and RAM as a screen.
The movie is stored in your phone (hard disk)
To watch it, you need to load it on the screen
The video player (loader) loads and prepares it
󹵙󹵚󹵛󹵜 Basic Functions of a Loader
Now let’s break down its functions one by one:
1. Allocation (Memory Allocation)
The loader decides where your program will be placed in memory.
󷷑󷷒󷷓󷷔 Example:
If your program needs 100 KB, the loader finds a suitable space in RAM.
2. Linking (Symbol Resolution)
Sometimes your program uses functions from other files or libraries.
󷷑󷷒󷷓󷷔 Example:
printf("Hello");
Here, printf() is not written by youit comes from a library.
󷷑󷷒󷷓󷷔 Loader connects your program with these external functions.
3. Relocation (Address Adjustment)
Your program may have addresses like:
Start at 1000
But in memory, it might be loaded at 5000.
󷷑󷷒󷷓󷷔 So the loader adjusts all addresses accordingly.
Easy2Siksha.com
4. Loading (Bringing Program into Memory)
This is the main job:
󷷑󷷒󷷓󷷔 Copy the program from disk → into RAM
5. Execution Start (Transfer Control)
After everything is ready:
󷷑󷷒󷷓󷷔 Loader starts execution from the entry point (main function)
󹵍󹵉󹵎󹵏󹵐 Diagram: Loader Working
󷘹󷘴󷘵󷘶󷘷󷘸 Summary of Loader Functions
Function
Meaning
Allocation
Finds memory space
Linking
Connects external functions
Relocation
Adjusts addresses
Loading
Copies program to RAM
Execution
Starts program
󷈷󷈸󷈹󷈺󷈻󷈼 7 (b) Difference between Static and Dynamic Linking
Now let’s understand this in a fun and relatable way.
Easy2Siksha.com
󹲉󹲊󹲋󹲌󹲍 First, what is Linking?
Linking means:
󷷑󷷒󷷓󷷔 Connecting your program with required libraries (functions/code)
Example:
printf() comes from a library
Your program needs to link with it
󹼤 Static Linking
󼩏󼩐󼩑 Concept
In static linking:
󷷑󷷒󷷓󷷔 All required libraries are copied into your program at compile time
So your final executable becomes big but independent.
󷘜󷘝󷘞󷘟󷘠󷘡󷘢󷘣󷘤󷘥󷘦 Real-Life Example
Think of downloading a movie with subtitles already inside the file.
󷷑󷷒󷷓󷷔 You don’t need internet later.
󹵍󹵉󹵎󹵏󹵐 Diagram: Static Linking
Easy2Siksha.com
󷄧󼿒 Advantages
Runs faster (no need to load libraries again)
Works without external dependencies
No runtime errors due to missing libraries
󽆱 Disadvantages
Large file size
Memory waste (same library copied in many programs)
Hard to update libraries
󺮥 Dynamic Linking
󼩏󼩐󼩑 Concept
In dynamic linking:
󷷑󷷒󷷓󷷔 Libraries are not copied into the program
󷷑󷷒󷷓󷷔 They are linked at runtime (when program runs)
󷘜󷘝󷘞󷘟󷘠󷘡󷘢󷘣󷘤󷘥󷘦 Real-Life Example
Think of streaming a movie online.
󷷑󷷒󷷓󷷔 Subtitles are loaded when needed.
Easy2Siksha.com
󹵍󹵉󹵎󹵏󹵐 Diagram: Dynamic Linking
󷄧󼿒 Advantages
Smaller executable size
Saves memory (shared libraries used by many programs)
Easy to update libraries
󽆱 Disadvantages
Slower than static linking (extra step at runtime)
Program may fail if library is missing
Dependency issues
Easy2Siksha.com
󽀼󽀽󽁀󽁁󽀾󽁂󽀿󽁃 Difference Between Static and Dynamic Linking
Feature
Static Linking
Dynamic Linking
When linking happens
Compile time
Run time
Library inclusion
Inside program
Outside program
File size
Large
Small
Speed
Faster
Slightly slower
Memory usage
More
Less
Dependency
No dependency
Depends on external libraries
Updates
Difficult
Easy
󷘹󷘴󷘵󷘶󷘷󷘸 Final Understanding
󷷑󷷒󷷓󷷔 Loader prepares your program to run by:
Allocating memory
Linking libraries
Adjusting addresses
Starting execution
󷷑󷷒󷷓󷷔 Static Linking vs Dynamic Linking:
Static → Everything included (like offline movie)
Dynamic → Loaded when needed (like streaming)
8. What do you mean by Editors? Discuss their usefulness with the help of suitable
examples.
Ans: 󷇮󷇭 What Do We Mean by Editors?
In computing, an editor is a software tool that allows users to create, modify, and manage
text or code. Think of it as your digital notebook or canvas. Just as writers use pens and
paper, programmers and users rely on editors to write instructions, documents, or even
design content.
󷷑󷷒󷷓󷷔 In simple terms: An editor is a program that lets you input, change, and organize
information (usually text or code) on a computer.
󽆪󽆫󽆬 Types of Editors
Editors come in different forms depending on what they’re used for. Let’s look at the main
categories:
Easy2Siksha.com
1. Text Editors
Used for writing and editing plain text.
Examples: Notepad, Vim, Nano, Sublime Text.
Useful for writing notes, configuration files, or simple scripts.
Analogy: Like a basic notebook where you jot down ideas.
2. Code Editors
Specialized text editors designed for programming.
Provide features like syntax highlighting, auto-completion, debugging tools.
Examples: Visual Studio Code, Atom, Eclipse.
Analogy: Like a notebook with built-in grammar checker and dictionary, helping you write
better code.
3. Word Processors
Editors designed for documents with formatting (fonts, styles, images).
Examples: Microsoft Word, Google Docs.
Useful for essays, reports, letters.
Analogy: Like a notebook that lets you decorate your writing with colors, pictures, and
styles.
4. Graphic Editors
Editors for creating and modifying images.
Examples: Adobe Photoshop, GIMP, MS Paint.
Useful for designers and artists.
Analogy: Like a digital canvas with brushes, colors, and tools.
5. Specialized Editors
Database editors (for managing data).
HTML editors (for web design).
Music editors (for composing).
Video editors (for editing films).
Diagram 1: Types of Editors
Code
Editors
── Text Editors (Notepad, Vim)
── Code Editors (VS Code, Eclipse)
── Word Processors (MS Word, Google Docs)
Easy2Siksha.com
── Graphic Editors (Photoshop, GIMP)
└── Specialized Editors (HTML, Video, Music)
󼩺󼩻 Usefulness of Editors
Editors are not just tools—they’re essential companions in computing. Let’s explore their
usefulness with examples.
1. Writing and Editing Code
Programmers rely on editors to write software.
Example: A student writing a C program in Visual Studio Code.
Features like syntax highlighting help spot errors quickly.
Benefit: Saves time and reduces mistakes.
2. Document Creation
Students, teachers, and professionals use word processors to create documents.
Example: Preparing a project report in MS Word.
Formatting tools make the report professional.
Benefit: Easy to present and share information.
3. Configuration and System Files
System administrators edit configuration files using text editors.
Example: Editing config.txt in Notepad++.
Helps customize software or operating systems.
Benefit: Direct control over system behavior.
4. Creative Work
Artists and designers use graphic editors.
Example: Designing a poster in Photoshop.
Tools allow image manipulation, layering, and effects.
Benefit: Enables creativity and professional design.
5. Collaboration
Modern editors allow multiple people to work together.
Easy2Siksha.com
Example: Writing a group assignment in Google Docs.
Everyone can edit in real-time.
Benefit: Encourages teamwork and productivity.
Diagram 2: Editor Usefulness
Editors → Code Writing → Document Creation → System Configuration → Creative Design
→ Collaboration
󷘜󷘝󷘞󷘟󷘠󷘡󷘢󷘣󷘤󷘥󷘦 Everyday Examples
Let’s imagine a day in the life of a student:
Morning: Writes notes in Notepad (text editor).
Afternoon: Codes a Java project in Eclipse (code editor).
Evening: Prepares a report in MS Word (word processor).
Night: Designs a poster for a college fest in Photoshop (graphic editor).
All of these tasks rely on editors. Without them, the student would struggle to interact with
the computer effectively.
󹵍󹵉󹵎󹵏󹵐 Advantages of Editors
User-Friendly: Easy to input and modify content.
Efficiency: Speeds up tasks with features like auto-completion.
Flexibility: Supports different file types and formats.
Creativity: Enables design and artistic work.
Collaboration: Allows multiple users to work together.
󺄄󺄅󺄌󺄆󺄇󺄈󺄉󺄊󺄋󺄍 Extra Diagrams
Diagram 3: Editor Workflow
User Input → Editor → Modify/Format → Save → Output File
Diagram 4: Code Editor Example
Code Editor
── Syntax Highlighting
── Auto-Completion
── Debugging Tools
└── Version Control Integration
Diagram 5: Word Processor Example
Word Processor
── Text Formatting
Easy2Siksha.com
── Image Insertion
── Tables & Charts
└── Collaboration Tools
󽆪󽆫󽆬 Conclusion
So, to wrap it up:
Editors are software tools that allow users to create, modify, and manage text, code,
or other content.
They come in many forms: text editors, code editors, word processors, graphic
editors, and specialized editors.
Their usefulness spans across programming, document creation, system
configuration, creative design, and collaboration.
Without editors, interacting with computers would be far less efficient and creative.
󷷑󷷒󷷓󷷔 In short, editors are the bridge between human ideas and computer executionturning
thoughts into tangible digital outputs.
This paper has been carefully prepared for educaonal purposes. If you noce any
mistakes or have suggesons, feel free to share your feedback.